<?php
require 'vendor/autoload.php';

define('ROOTPATH',dirname(__FILE__).'/storage/');

$parser = new \cebe\markdown\GithubMarkdown();

$file_path = isset($_GET['path'])?$_GET['path']:'';

if ( strpos($file_path,'..') !== False or empty($file_path)) {
	die('error');
}
$file_path = ROOTPATH . $file_path;

$markdown = file_get_contents($file_path);
$parser->html5 = true;
$html = $parser->parse($markdown);
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link rel="stylesheet" href="http://www.sadk.org/usr/themes/maupassant/style.css">
</head>
<body>
<div class="container">
	<article>
	<?php 
		echo $html;
	?>
	</article>
</div>
</body>
</html>